package org.gw.building.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.gw.building.dto.Tyxx;
import org.gw.building.model.base.*;
import org.gw.ylc.base.model.Xl;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by qwx89 on 2017/8/6.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "T_TQTJ_TYXXCJB")
@Builder
public class Tyxxcjb {

  @Id
  @GeneratedValue(generator = "uuid")
  @GenericGenerator(name = "uuid", strategy = "uuid")
  private String cjbid;

  private String cjzbid;

  private String id;

  private String yx;

  @OneToOne
  @JoinColumn(name = "zbmc")
  private Bm zbmc;

  private String xh;

  private String xm;

  @ManyToOne
  @JoinColumn(name = "xb")
  private Xb xb;

  private Date csrq;

  @OneToOne
  @JoinColumn(name = "mz")
  private Mz mz;

  @OneToOne
  @JoinColumn(name = "zzmm")
  private Zzmm zzmm;

  @OneToOne
  @JoinColumn(name = "whcd")
  private Xl whcd;

  private boolean tgb;

  private boolean zbsj;

  private boolean zbwy;

  private String tnzw;

  private String bz;

  private Date rtrq;

  private Date sqrdrq;

  private Date tntyrq;

  private Date fzwybdyrq;

  private Date zzrq;

  @OneToOne
  @JoinColumn(name = "lx")
  private Rylx lx;

  private boolean scbz;

  @OneToOne
  @JoinColumn(name = "sjly")
  private Sjly sjly;

  private String czr;

  private Date czsj;

  private String xgr;

  private Date xgsj;

  @ManyToOne
  @JoinColumn(name = "gxzt")
  private Gxzt gxzt;

  @Transient
  public boolean realDel() {
    if (gxzt == null || StringUtils.equals("1", gxzt.getDm())) {
      return true;
    }
    return false;
  }
  @Transient
  private Tyxx tyxx;
}
